<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

use App\Post;

Route::get('/', function () {
	return view('welcome');
});

Route::get('/welcome', array(
	'uses' => 'PostController@index',
	'as'   => 'welcome'
));

Route::get('/post/create', [
		'uses' => 'PostController@create',
		'as'   => 'createPost'
	]);

Route::post('/post/store', [
	'uses' => 'PostController@store',
	'as'   => 'storePost'
]);

Route::get('/post/{id}', [
	'uses' => 'PostController@show',
]);

Route::get('/mail', function(){
	$result = Mail::send('emails.welcome', ['key' => 'value'], function($message)
	{
		$message->from('system@luokuncool.com', 'Laravel')->to('1131915347@qq.com', 'John Smith')->subject('Welcome!');
	});
	var_dump($result);
});

Route::get('/dump', function(){
	$posts = Post::paginate(1);
	print_r($posts);
});

Route::get('/session', function(){
	Session::set('test', '8888');
	echo Session::get('test');
});